package net.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "HISTOGRAMA_CLASE")
public class HistogramClase implements Serializable {

	private static final long serialVersionUID = 3604878443958713867L;

	@EmbeddedId
	private HistogramClasePK histogramClase;

	@Column(name = "indice")
	private Integer indice;

	public HistogramClase(Clase clase, Histogram histogram) {
		super();
		histogramClase = new HistogramClasePK(clase, histogram);
	}

	public HistogramClase() {
		super();
	}

	public HistogramClasePK getHistogramClase() {
		return histogramClase;
	}

	public void setHistogramClase(HistogramClasePK histogramClase) {
		this.histogramClase = histogramClase;
	}

	public Integer getIndice() {
		return indice;
	}

	public void setIndice(Integer indice) {
		this.indice = indice;
	}

	public Clase getClase() {
		return getHistogramClase().getClase();
	}

	public void setClase(Clase clase) {
		getHistogramClase().setClase(clase);
	}

	public Histogram getHistogram() {
		return getHistogramClase().getHistogram();
	}

	public void setHistogram(Histogram histogram) {
		getHistogramClase().setHistogram(histogram);
	}

	public boolean equals(Object o) {
		if (o == null)
			return false;
		if (!(o instanceof HistogramClase))
			return false;
		HistogramClase r = (HistogramClase) o;
		if (getHistogramClase() != null)
			return r.equals(getHistogramClase());
		return false;
	}

	public String toString() {
		if (getHistogramClase() != null)
			return getHistogramClase().toString();
		return "";
	}

	public int hashCode() {
		return this.histogramClase.hashCode() + this.indice.hashCode();
	}
}
